let str = '1';

function find(str) {
    if (str.length == 1) {
        return str;
    }
    let arr = str.split(',');
    let obj = {};
    for (let i = 0; i < arr.length; i++) {
        let e = arr[i];
        if (obj['n' + e] == undefined) {
            obj['n' + e] = 0;
        } else {
            obj['n' + e]++;
        }
    }
    //找最大
    let max = 0;
    for (const k in obj) {
        if (obj.hasOwnProperty(k)) {
            const element = obj[k];
            if (element > max) {
                max = element;
            }
        }
    }
    //删除
    let res = [];
    for (let k in obj) {
        if (obj.hasOwnProperty(k)) {
            const element = obj[k];
            if (element != max) {
                res.push(k.toString().split('')[1]);
            }
        }
    }
    return res.join(',');
}


console.log(find(str));